package com.hup.htts;

import com.hup.htts.presenter.MainPresenter;
import com.hup.utils.commons.start.AppInfo;
import com.hup.utils.commons.start.LongBeanNameGenerator;
import com.hup.utils.commons.start.LookThemeUtil;
import com.hup.utils.commons.start.SpringContext;
import com.hup.utils.commons.start.StartUpWindow;
import com.hup.utils.commons.swing.SwingExecutable;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;

/**
 * @author hugan
 * @date 2021/9/12
 */
@SpringBootApplication
@ComponentScan(basePackages = {"com.hup.utils.commons.start", "com.hup.htts"})
@AppInfo(chName = "朗读工具")
public class Htts {

    public static void main(String[] args) {
        LookThemeUtil.initNormal(null);
        StartUpWindow.startUp(() -> init(args));
    }

    private static void init(String[] args) throws Exception {
        SpringApplicationBuilder builder = new SpringApplicationBuilder(Htts.class);
        builder.headless(false).beanNameGenerator(new LongBeanNameGenerator()).run(args);

        SwingExecutable.initSwingExecutor();
        SpringContext.getBean(MainPresenter.class).startUp();
    }

}
